#******************************************************************
#
# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

##
# liboc_logger examples build script
##

Import('env')

lib_env = env.Clone()
SConscript('#resource/third_party_libs.scons', 'lib_env')

examples_env = lib_env.Clone()
######################################################################
# Build flags
######################################################################
examples_env.PrependUnique(CPPPATH=['../include'])
examples_env.Append(LIBS=['c_common'])

compiler = env.get('CC')
if compiler != 'cl':
    examples_env.AppendUnique(LIBS=['stdc++'])

target_os = env.get('TARGET_OS')

if target_os not in ['msys_nt', 'windows']:
    examples_env.AppendUnique(CFLAGS=Split('-Wall -std=c99 -Werror'))
    examples_env.AppendUnique(CXXFLAGS=Split('-Wall -std=c++0x'))
    examples_env.AppendUnique(LIBS=['oc_logger'])

    if target_os == 'android':
        examples_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
        examples_env.PrependUnique(LIBS=['gnustl_shared'])
else:
    examples_env.AppendUnique(LIBS=['octbstack'])

######################################################################
# Source files and Targets
######################################################################
examples = []
examples += examples_env.Program('test_logging_c', 'test_logging.c', OBJPREFIX='c_')
examples += examples_env.Program('test_logging_cpp', 'test_logging.cpp')

Alias('liboc_logger_examples', examples)
examples_env.AppendTarget('liboc_logger_examples')
examples_env.UserInstallTargetExtra(examples)
